// 你可以对 `defineStore()` 的返回值进行任意命名，但最好使用 store 的名字，同时以 `use` 开头且以 `Store` 结尾。(比如 `useUserStore`，`useCartStore`)
// 第一个参数是你的应用中 Store 的唯一 ID,第二个参数可接受两类值：Setup 函数或 Option 对象。
// 当前项目使用Setup 函数
// setup中：ref等于state  computed等于getters methods等于actions
import { defineStore } from "pinia";
import piniaPersistConfig from "./piniaPersist";
const piniaName = "touristHomepage";
export const useTouristHomepageStore = defineStore(
    piniaName,
    () => {
        const setTouristCategory = ref(null);
        const setTouristCategoryStore = (val) => {
            setTouristCategory.value = val;
        };
        // 存储当前点击省份的地市
        const setTouristCity = ref(null);
        const setTouristCityStore = (val) => {
            setTouristCity.value = val;
        }
        // 存储当前点击地市信息
        const setTouristCityInfo = ref(null);
        const setTouristCityInfoStore = (val) => {
            setTouristCityInfo.value = val;
        }
        // 当前旅游种类
        const setTouristType = ref(null);
        // 当前点击的小类
        const setTouristLittle = ref(null);
        // 记录当前游前规划种类
        const setTouristPredict  = (val) => {
            setTouristType.value = val;
        }
        // 存储当前游前规划种类小类
        const setTouristLittleStore = (val) => {
            setTouristLittle.value = val;
        }
        // 存入游前规划的配置
        const setTouristPredictOffice = ref(null);
        const setTouristPredictStore = (val) => {
            setTouristPredictOffice.value = val;
        }
        // 存入store目前是否点击新建对话
        const touristClearStatus=  ref(null);
        const setTouristClearStatus = (val)=>{
            touristClearStatus.value = val;
        }
        // 存储用户信息
        const setUserInfo = ref(null);
        const setUserInfoStore = (val) => {
            setUserInfo.value = val;
        }
        // 旅游路线规划选择
        const setTouristAiDataTourRoute = ref(null);
        const setTouristTourRoute=(val)=>{
            setTouristAiDataTourRoute.value = val;

        }
        // 旅游foodRoute规划选择
        const setTouristAiDataFoodRoute = ref(null);
        const setTouristFoodRoute=(val)=>{
            setTouristAiDataFoodRoute.value = val;

        }
        // 旅游transRoute规划选择
        const setTouristAiDataTransRoute = ref(null);
        const setTouristTransRoute=(val)=>{
            setTouristAiDataTransRoute.value = val;
        }
        // 实用贴士规划选择
        const setTouristAiDataPracticalTips = ref(null);
        const setTouristPracticalTips=(val)=>{
            setTouristAiDataPracticalTips.value = val;
        }
        // 清除
        const clearTouristAiData = ()=>{
            setTouristCategory.value = null;
            setTouristCity.value = null;
            setTouristType.value = null;
            setTouristLittle.value = null;
            touristClearStatus.value = null;
            setTouristPredictOffice.value = null;
            setUserInfo.value = null;
            setTouristAiDataTourRoute.value = null;
            setTouristAiDataFoodRoute.value = null;
            setTouristAiDataTransRoute.value = null;
            setTouristAiDataPracticalTips.value = null;
        }

        return {
            setTouristCategory,setTouristCategoryStore,setTouristCity,setTouristCityStore,
            setTouristType,setTouristPredict,setTouristLittle,setTouristLittleStore,
            setTouristPredictStore,setTouristPredictOffice,
            touristClearStatus,setTouristClearStatus,setUserInfo,setUserInfoStore,
            setTouristAiDataTourRoute,setTouristTourRoute,
            setTouristAiDataFoodRoute,setTouristFoodRoute,
            setTouristAiDataTransRoute,setTouristTransRoute,
            setTouristAiDataPracticalTips,setTouristPracticalTips,
            clearTouristAiData,setTouristCityInfo,setTouristCityInfoStore
        }
    },
    {
        persist: piniaPersistConfig(piniaName, true)
    }

)